
setTimeout(_ => console.log(1))

new Promise(resolve => {
    resolve()
    console.log(2)
}).then(_ => {
    console.log(3)
    Promise.resolve().then(_ => {
        console.log(4)
    }).then(_ => {
        Promise.resolve().then(_ => {
            console.log(5)
        })
    })
})

console.log(6)

// 2 6 3 4 5 1